package collection2;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.PriorityQueue;

/**
 * @Auther: 杨通通
 * @Date: 2024/10/26 23:57
 * @Description:
 */
public class priorityQueue1 {

    public static void main(String[] args) {
        PriorityQueue<Integer> q1 = new PriorityQueue<>();
        q1.add(6);
        q1.add(5);
        q1.add(2);
        q1.add(214);
        System.out.println(q1);

        System.out.println(q1.poll());

        PriorityQueue<Person> q2 = new PriorityQueue<>();
        q2.add(new Person(12,"ytt"));
        q2.add(new Person(13,"yt"));
        q2.add(new Person(200,"a"));
        q2.add(new Person(200,"y"));
        System.out.println(q2);

        byte[] bytes = "abc你".getBytes();

    }
}


@Data
@AllArgsConstructor
class Person implements Comparable<Person>{
    private Integer age;
    private String name;

    @Override
    public int compareTo(Person o) {
        return this.name.compareTo(o.name);
    }

//    @Override
//    public int compareTo(Person o) {
//        return this.age - o.age;
//    }

}